home *** CD-ROM | disk | FTP | other *** search
- Path: news.helsinki.fi!not-for-mail
- From: marjakan@cc.helsinki.fi (Erkka I Marjakangas)
- Newsgroups: comp.lang.c++
- Subject: Help: very simple(?) array problem
- Date: 10 Apr 1996 00:12:31 +0300
- Organization: University of Helsinki
- Message-ID: <4kejrv$ml2@kruuna.helsinki.fi>
- NNTP-Posting-Host: kruuna.helsinki.fi
- Mime-Version: 1.0
- Content-Type: text/plain; charset=ISO-8859-1
- Content-Transfer-Encoding: 8bit
-
- I have tried to get a piece of code to work for couple of hours now and
- I don't know any longer what is wrong with it. All seems OK with me, but
- still compiler (both GNU-C++ and C++) give an error:
- "initializer for scalar variable requires one element".
- I'm totally confused.
-
- The code looks following...
-
- class Object
- {
- ...
- Object(char **name);
- ...
- };
-
- Object::Object(char **name)
- {
- ...
- }
-
- main()
- {
- char **b={"First","Second"};
- Object a(b);
- }
-
- If I change main() to
- {
- Object a({"First","Second"});
- }
-
- both compilers report "parse error before {" at that line which
- contains Object a(...);
-
- I simply cannot understand what can be wrong, to me it looks just fine.
- Can anyone help?
-
- Thanks in advance,
- Ede
-
- --
- Erkka Marjakangas, Hietaniemenk14A209,00100 HKI, FINLAND| To SEE or
- marjakan@cc.helsinki.fi Tel: +358-40-512 06 36 | not to SEE,
- WWW:<A HREF="http://www.helsinki.fi/~marjakan/">Home</A>| now that is
- A2000/A3001/4MB/80MB/A2286[PGP key available at request]| the question!
-